home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / PCIPlugin.p < prev    next >
Text File  |  1996-05-01  |  12KB  |  272 lines

  1. {
  2.      File:        PCIPlugin.p
  3.  
  4.      Contains:    This file contains all interface related structures and prototypes for pci expert to plugin
  5.  
  6.      Version:    Technology:    Copland
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT PCIPlugin;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __PCIPLUGIN__}
  28. {$SETC __PCIPLUGIN__ := 1}
  29.  
  30. {$I+}
  31. {$SETC PCIPluginIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __PCICOMMONPLUGIN__}
  35. {$I PCICommonPlugin.p}
  36. {$ENDC}
  37.  
  38. {$PUSH}
  39. {$ALIGN MAC68K}
  40. {$LibExport+}
  41.  
  42. {$IFC FOR_SYSTEM8_PREEMPTIVE }
  43. {  subordinate pci device tree 'reg' property structure definition }
  44.  
  45. TYPE
  46.     PCIRegPropertyPtr = ^PCIRegProperty;
  47.     PCIRegProperty = RECORD
  48.         physicalHigh:            UInt32;
  49.         physicalMiddle:            UInt32;
  50.         physicalLow:            UInt32;
  51.         propAddress:            UInt32;
  52.         propLength:                UInt32;
  53.     END;
  54.  
  55. {  pci device tree 'bus-range' property structure definition }
  56.     PCIBusRangePropertyPtr = ^PCIBusRangeProperty;
  57.     PCIBusRangeProperty = RECORD
  58.         lowBus:                    UInt32;
  59.         highBus:                UInt32;
  60.     END;
  61.  
  62. {  subordinate pci device description table entry header structure definition }
  63.     ConfigAddress                        = LogicalAddress;
  64.     IOAddress                            = LogicalAddress;
  65.     PCIDeviceTableEntryHeaderPtr = ^PCIDeviceTableEntryHeader;
  66.     PCIDeviceTableEntryHeader = RECORD
  67.         entry:                    RegEntryRef;
  68.         name:                    PACKED ARRAY [0..31] OF CHAR;
  69.         pciDomain:                UInt32;
  70.         pciBusNumber:            UInt32;
  71.         pciSecondBusNumber:        UInt32;
  72.         accessType:                UInt32;
  73.         regProperty:            PCIRegPropertyPtr;
  74.         regPropertyCount:        ByteCount;
  75.         ioBase:                    IOAddress;
  76.         rangeBase:                LogicalAddress;
  77.     END;
  78.  
  79. {  subordinate pci device description table entry structure definition }
  80.     PCIDeviceTableEntryPtr = ^PCIDeviceTableEntry;
  81.     PCIDeviceTableEntry = RECORD
  82.         nextDeviceEntry:        PCIDeviceTableEntryPtr;
  83.         header:                    PCIDeviceTableEntryHeader;
  84.         BridgePlugin:            PCIBridgeDescriptorPtr;
  85.         pluginSpecificStuff:    ARRAY [0..15] OF UInt32;
  86.     END;
  87.  
  88. {  type defs for plugin interfaces }
  89.     ConfigReadByteFuncPtr = ProcPtr;  { FUNCTION ConfigReadByteFuncPtr(configAddr: ConfigAddress; VAR valuePtr: UInt8; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  90.  
  91.     ConfigReadWordFuncPtr = ProcPtr;  { FUNCTION ConfigReadWordFuncPtr(configAddr: ConfigAddress; VAR valuePtr: UInt16; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  92.  
  93.     ConfigReadLongFuncPtr = ProcPtr;  { FUNCTION ConfigReadLongFuncPtr(configAddr: ConfigAddress; VAR valuePtr: UInt32; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  94.  
  95.     ConfigWriteByteFuncPtr = ProcPtr;  { FUNCTION ConfigWriteByteFuncPtr(configAddr: ConfigAddress; valuePtr: ByteParameter; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  96.  
  97.     ConfigWriteWordFuncPtr = ProcPtr;  { FUNCTION ConfigWriteWordFuncPtr(configAddr: ConfigAddress; valuePtr: UInt16; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  98.  
  99.     ConfigWriteLongFuncPtr = ProcPtr;  { FUNCTION ConfigWriteLongFuncPtr(configAddr: ConfigAddress; valuePtr: UInt32; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  100.  
  101.     IOReadByteFuncPtr = ProcPtr;  { FUNCTION IOReadByteFuncPtr(ioAddr: IOAddress; VAR valuePtr: UInt8; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  102.  
  103.     IOReadWordFuncPtr = ProcPtr;  { FUNCTION IOReadWordFuncPtr(ioAddr: IOAddress; VAR valuePtr: UInt16; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  104.  
  105.     IOReadLongFuncPtr = ProcPtr;  { FUNCTION IOReadLongFuncPtr(ioAddr: IOAddress; VAR valuePtr: UInt32; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  106.  
  107.     IOWriteByteFuncPtr = ProcPtr;  { FUNCTION IOWriteByteFuncPtr(ioAddr: IOAddress; valuePtr: ByteParameter; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  108.  
  109.     IOWriteWordFuncPtr = ProcPtr;  { FUNCTION IOWriteWordFuncPtr(ioAddr: IOAddress; valuePtr: UInt16; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  110.  
  111.     IOWriteLongFuncPtr = ProcPtr;  { FUNCTION IOWriteLongFuncPtr(ioAddr: IOAddress; valuePtr: UInt32; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  112.  
  113.     IntAckReadByteFuncPtr = ProcPtr;  { FUNCTION IntAckReadByteFuncPtr(VAR valuePtr: UInt8; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  114.  
  115.     IntAckReadWordFuncPtr = ProcPtr;  { FUNCTION IntAckReadWordFuncPtr(VAR valuePtr: UInt16; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  116.  
  117.     IntAckReadLongFuncPtr = ProcPtr;  { FUNCTION IntAckReadLongFuncPtr(VAR valuePtr: UInt32; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  118.  
  119.     SpecialCycleWriteLongFuncPtr = ProcPtr;  { FUNCTION SpecialCycleWriteLongFuncPtr(valuePtr: UInt32; pciDeviceHead: PCIDeviceTableEntryPtr): OSStatus; C; }
  120.  
  121.     InitDeviceEntryFuncPtr = ProcPtr;  { FUNCTION InitDeviceEntryFuncPtr(deviceDescriptor: PCIDeviceTableEntryPtr): OSStatus; C; }
  122.  
  123.     GetIOBaseFuncPtr = ProcPtr;  { FUNCTION GetIOBaseFuncPtr(deviceDescriptor: PCIDeviceTableEntryPtr; VAR ioBase: IOAddress): OSStatus; C; }
  124.  
  125. {  pci domain descriptor definition }
  126.     PCIControlDescriptorPtr = ^PCIControlDescriptor;
  127.     PCIControlDescriptor = RECORD
  128.         InterfaceHeader:        PCIPluginHeader;
  129.         PCIDeviceDescriptor:    PCIDeviceTableEntry;
  130.         TheDomainDriverDescription: DriverDescriptionPtr;
  131.         InitializeFunc:            InitializeFuncPtr;
  132.         ConfigReadByteFunc:        ConfigReadByteFuncPtr;
  133.         ConfigReadWordFunc:        ConfigReadWordFuncPtr;
  134.         ConfigReadLongFunc:        ConfigReadLongFuncPtr;
  135.         ConfigWriteByteFunc:    ConfigWriteByteFuncPtr;
  136.         ConfigWriteWordFunc:    ConfigWriteWordFuncPtr;
  137.         ConfigWriteLongFunc:    ConfigWriteLongFuncPtr;
  138.         IOReadByteFunc:            IOReadByteFuncPtr;
  139.         IOReadWordFunc:            IOReadWordFuncPtr;
  140.         IOReadLongFunc:            IOReadLongFuncPtr;
  141.         IOWriteByteFunc:        IOWriteByteFuncPtr;
  142.         IOWriteWordFunc:        IOWriteWordFuncPtr;
  143.         IOWriteLongFunc:        IOWriteLongFuncPtr;
  144.         IntAckReadByteFunc:        IntAckReadByteFuncPtr;
  145.         IntAckReadWordFunc:        IntAckReadWordFuncPtr;
  146.         IntAckReadLongFunc:        IntAckReadLongFuncPtr;
  147.         SpecialCycleWriteLongFunc: SpecialCycleWriteLongFuncPtr;
  148.         InitDeviceEntryFunc:    InitDeviceEntryFuncPtr;
  149.         GetIOBaseFunc:            GetIOBaseFuncPtr;
  150.         FinalizeFunc:            FinalizeFuncPtr;
  151.     END;
  152.  
  153. {  Prototypes for the PIM }
  154. FUNCTION PCIPluginInitialize: OSStatus; C;
  155. FUNCTION PCIPluginConfigReadByte(configAddr: ConfigAddress; VAR valuePtr: UInt8; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  156. FUNCTION PCIPluginConfigReadWord(configAddr: ConfigAddress; VAR valuePtr: UInt16; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  157. FUNCTION PCIPluginConfigReadLong(configAddr: ConfigAddress; VAR valuePtr: UInt32; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  158. FUNCTION PCIPluginConfigWriteByte(configAddr: ConfigAddress; value: ByteParameter; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  159. FUNCTION PCIPluginConfigWriteWord(configAddr: ConfigAddress; value: UInt16; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  160. FUNCTION PCIPluginConfigWriteLong(configAddr: ConfigAddress; value: UInt32; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  161. FUNCTION PCIPluginIOReadByte(ioAddr: IOAddress; VAR valuePtr: UInt8; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  162. FUNCTION PCIPluginIOReadWord(ioAddr: IOAddress; VAR valuePtr: UInt16; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  163. FUNCTION PCIPluginIOReadLong(ioAddr: IOAddress; VAR valuePtr: UInt32; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  164. FUNCTION PCIPluginIOWriteByte(ioAddr: IOAddress; value: ByteParameter; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  165. FUNCTION PCIPluginIOWriteWord(ioAddr: IOAddress; value: UInt16; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  166. FUNCTION PCIPluginIOWriteLong(ioAddr: IOAddress; value: UInt32; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  167. FUNCTION PCIPluginIntAckReadByte(VAR valuePtr: UInt8; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  168. FUNCTION PCIPluginIntAckReadWord(VAR valuePtr: UInt16; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  169. FUNCTION PCIPluginIntAckReadLong(VAR valuePtr: UInt32; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  170. FUNCTION PCIPluginSpecialCycleWriteLong(value: UInt32; pciDeviceEntry: PCIDeviceTableEntryPtr): OSStatus; C;
  171. FUNCTION PCIPluginInitDeviceEntry(deviceDescriptor: PCIDeviceTableEntryPtr): OSStatus; C;
  172. FUNCTION PCIPluginGetIOBase(deviceDescriptor: PCIDeviceTableEntryPtr; VAR ioBase: IOAddress): OSStatus; C;
  173. FUNCTION PCIPluginFinalize: OSStatus; C;
  174. {  general purpose pci masks }
  175.  
  176. CONST
  177.     kPCIconfigAddrReservedValue    = $00000000;
  178.     kPCIconfigAddrReservedMask    = $FF000000;
  179.     kPCIconfigAddrBusNumberMask    = $00FF0000;
  180.     kPCIconfigAddrDeviceNumberMask = $0000F800;
  181.     kPCIconfigAddrFunctionNumberMask = $00000700;
  182.     kPCIconfigAddrRegisterNumberMask = $000000FC;
  183.     kPCIconfigAddrAccessTypeMask = $00000001;
  184.     kPCIregisterByteMask        = $00000003;
  185.     kPCIregisterNotByteMask        = $FFFFFFFC;
  186.     kPCIregisterWordMask        = $00000002;
  187.  
  188. {  pci encoded-int structure constants definition }
  189.     kPCIPhysicalHighRelocatableMask = $80000000;
  190.     kPCIPhysicalHighRelocatable    = $80000000;
  191.     kPCIPhysicalHighPrefetchableMask = $40000000;
  192.     kPCIPhysicalHighPrefetchable = $40000000;
  193.     kPCIPhysicalHighAliasedMask    = $20000000;
  194.     kPCIPhysicalHighAliased        = $20000000;
  195.     kPCIPhysicalHighSpaceCodeMask = $03000000;
  196.     kPCIPhysicalHighSpaceCodeConfig = $00000000;
  197.     kPCIPhysicalHighSpaceCodeIO    = $01000000;
  198.     kPCIPhysicalHighSpaceCodeMemory = $02000000;
  199.     kPCIPhysicalHighSpaceCode64Bit = $03000000;
  200.     kPCIPhysicalHighBusMask        = $00FF0000;
  201.     kPCIPhysicalHighDeviceMask    = $0000F800;
  202.     kPCIPhysicalHighDevice0        = $00000000;
  203.     kPCIPhysicalHighDevice1        = $00000800;
  204.     kPCIPhysicalHighDevice2        = $00001000;
  205.     kPCIPhysicalHighDevice3        = $00001800;
  206.     kPCIPhysicalHighDevice4        = $00002000;
  207.     kPCIPhysicalHighDevice5        = $00002800;
  208.     kPCIPhysicalHighDevice6        = $00003000;
  209.     kPCIPhysicalHighDevice7        = $00003800;
  210.     kPCIPhysicalHighDevice8        = $00004000;
  211.     kPCIPhysicalHighDevice9        = $00004800;
  212.     kPCIPhysicalHighDevice10    = $00005000;
  213.     kPCIPhysicalHighDevice11    = $00005800;
  214.     kPCIPhysicalHighDevice12    = $00006000;
  215.     kPCIPhysicalHighDevice13    = $00006800;
  216.     kPCIPhysicalHighDevice14    = $00007000;
  217.     kPCIPhysicalHighDevice15    = $00007800;
  218.     kPCIPhysicalHighDevice16    = $00008000;
  219.     kPCIPhysicalHighDevice17    = $00008800;
  220.     kPCIPhysicalHighDevice18    = $00009000;
  221.     kPCIPhysicalHighDevice19    = $00009800;
  222.     kPCIPhysicalHighDevice20    = $0000A000;
  223.     kPCIPhysicalHighDevice21    = $0000A800;
  224.     kPCIPhysicalHighDevice22    = $0000B000;
  225.     kPCIPhysicalHighDevice23    = $0000B800;
  226.     kPCIPhysicalHighDevice24    = $0000C000;
  227.     kPCIPhysicalHighDevice25    = $0000C800;
  228.     kPCIPhysicalHighDevice26    = $0000D000;
  229.     kPCIPhysicalHighDevice27    = $0000D800;
  230.     kPCIPhysicalHighDevice28    = $0000E000;
  231.     kPCIPhysicalHighDevice29    = $0000E800;
  232.     kPCIPhysicalHighDevice30    = $0000F000;
  233.     kPCIPhysicalHighDevice31    = $0000F800;
  234.     kPCIPhysicalHighFunctionMask = $00000700;
  235.     kPCIPhysicalHighFunction0    = $00000000;
  236.     kPCIPhysicalHighFunction1    = $00000100;
  237.     kPCIPhysicalHighFunction2    = $00000200;
  238.     kPCIPhysicalHighFunction3    = $00000300;
  239.     kPCIPhysicalHighFunction4    = $00000400;
  240.     kPCIPhysicalHighFunction5    = $00000500;
  241.     kPCIPhysicalHighFunction6    = $00000600;
  242.     kPCIPhysicalHighFunction7    = $00000700;
  243.     kPCIPhysicalHighRegisterMask = $000000FF;
  244.     kPCIPhysicalHighRegisterVendorID = $00000000;
  245.     kPCIPhysicalHighRegisterDeviceID = $00000002;
  246.     kPCIPhysicalHighRegisterCommand = $00000004;
  247.     kPCIPhysicalHighRegisterRevisionID = $00000008;
  248.     kPCIPhysicalHighRegisterCacheLineSIze = $0000000C;
  249.     kPCIPhysicalHighRegisterHeaderType = $0000000E;
  250.     kPCIPhysicalHighRegisterBaseAddress = $00000010;
  251.     kPCIPhysicalHighRegisterBridgeBusInfo = $00000018;
  252.     kPCIPhysicalHighRegisterCardbusCIS = $00000028;
  253.     kPCIPhysicalHighRegisterSubsystemVendorID = $0000002C;
  254.     kPCIPhysicalHighRegisterExpansionROMBase = $00000030;
  255.     kPCIPhysicalHighRegisterInterruptLine = $0000003C;
  256.  
  257. {  pci cycle access type for forwarding }
  258.     kPCIaccessType0                = 0;
  259.     kPCIaccessType1                = 1;
  260.  
  261. {$ENDC}
  262. {$ALIGN RESET}
  263. {$POP}
  264.  
  265. {$SETC UsingIncludes := PCIPluginIncludes}
  266.  
  267. {$ENDC} {__PCIPLUGIN__}
  268.  
  269. {$IFC NOT UsingIncludes}
  270.  END.
  271. {$ENDC}
  272.